ultrasonic3 2.2.0
Loading...
Searching...
No Matches
main.c File Reference

Ultrasonic 3 Click example. More...

#include "board.h"
#include "log.h"
#include "ultrasonic3.h"

Functions

void application_init (void)
void application_task (void)
int main (void)
void chbsp_print_str (const char *str)

Detailed Description

Ultrasonic 3 Click example.

Description

This example demonstrates ranging with Ultrasonic 3 Click (Chirp/TDK time-of-flight). The example periodically triggers a measurement and prints the measured distance to the USB UART.

The demo application is composed of two sections :

Application Init

Initialize the USB UART logger and the Ultrasonic 3 driver, then apply the default configuration to start the sensor and prepare it for continuous single-shot ranging.

Application Task

Triggers a measurement and logs results (distance, sample number, and amplitude) every 100ms.

Note
Make sure to configure falling-edge external interrupt on INT pin in bsp.c for your selected setup. Currently, only 3 interrupts are pre-configured for the following setups:
  • MCU Card for STM32 STM32F407ZG (MIKROBUS1)
  • MCU Card for Tiva TM4C129XNCZAD (MIKROBUS1)
  • MCU Card for PIC32 PIC32MX795F512L (MIKROBUS1)
Author
Stefan Filipovic

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ chbsp_print_str()

void chbsp_print_str ( const char * str)

◆ main()

int main ( void )